package pl.edu.agh.dosgi.logging.util;

import java.util.LinkedList;
import java.util.List;

import org.osgi.service.log.LogListener;
import org.osgi.service.log.LogReaderService;

public class LogReadersHolder {

	private List<LogReaderService> logReaders = new LinkedList<LogReaderService>();
	private LogListener logListener;
	
	public LogReadersHolder(LogListener logListener) {
		super();
		this.logListener = logListener;
	}

	public void addLogReader(LogReaderService logReader) {
		logReaders.add(logReader);
	}
	
	public void removeLogReader(LogReaderService logReader) {
		logReaders.remove(logReader);
	}
	
	public void removeLogListenerFromReaders() {
		for (LogReaderService logReader : logReaders) {
			logReader.removeLogListener(logListener);
		}
	}
}
